package com.danicsoft.daide.command;

import com.danicsoft.daide.token.TokenMap;
import com.danicsoft.daide.token.TokenMap.Commands;
import com.danicsoft.daide.token.TokenGroup;

/**
 * Implements the PRN command. From Eric Wald's <a
 * href="http://pydip.brainshell.org/docs/syntax.html">protocol specification</a>,
 * v0.14
 * <h4><a name="PRN">server_message = PRN</a> (message)</h4>
 * <p>
 * This message is sent from the server to the client, and indicates that
 * <b>message</b> was received from the client by the server, but does not have
 * a correct set of parentheses. The <b>PRN</b> message will also not have
 * matching parentheses; the client should cope with this. No reply should be
 * sent to the server.
 * </p>
 * 
 * @author Daniel Yule (daniel.yule@gmail.com)
 * @version 1.0
 */
public class ParenthesisCommand extends Command {

	/**
	 * The list of tokens that has an error in it
	 */
	private TokenGroup tokenList;
	
	/**
	 * Construct a new <code>ParenthesisCommand</code> from the given flat list of tokens.
	 * @param tokenList
	 */
	public ParenthesisCommand(TokenGroup tokenList) {
		this.tokenList = tokenList;
	}
	
	@Override
	public byte getType() {
		return Commands.PRN;
	}

	@Override
	public String toString() {
		return "Parenthesis parsing error.";
	}

	public void doIO(TokenIO tokenIO, TokenGroup tokens) throws ParseException {
	

	}

	@Override
	public TokenGroup output() {
		TokenGroup rGroup = new TokenGroup();
		rGroup.add(TokenMap.getCommandToken(Commands.PRN));
		rGroup.add(tokenList);
		return rGroup;
	}

}
